<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>17 P | Glossary</title>
<meta name="author" content="psyTeachR Team">
<meta name="description" content="17.1 p-value The probability of seeing an effect at least as extreme as what you have, if the real effect was the value you are testing against (e.g., a null effect) For example, if you used a...">
<meta name="generator" content="bookdown 0.24 with bs4_book()">
<meta property="og:title" content="17 P | Glossary">
<meta property="og:type" content="book">
<meta property="og:url" content="https://psyteachr.github.io/glossary/p.html">
<meta property="og:image" content="https://psyteachr.github.io/glossary/images/logos/logo.png">
<meta property="og:description" content="17.1 p-value The probability of seeing an effect at least as extreme as what you have, if the real effect was the value you are testing against (e.g., a null effect) For example, if you used a...">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="17 P | Glossary">
<meta name="twitter:description" content="17.1 p-value The probability of seeing an effect at least as extreme as what you have, if the real effect was the value you are testing against (e.g., a null effect) For example, if you used a...">
<meta name="twitter:image" content="https://psyteachr.github.io/glossary/images/logos/logo.png">
<!-- JS --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipboard.min.js" integrity="sha256-inc5kl9MA1hkeYUt+EC3BhlIgyp/2jDIyBLS6k3UxPI=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" integrity="sha512-zv6Ywkjyktsohkbp9bb45V6tEMoWhzFzXis+LrMehmJZZSys19Yxf1dopHx7WzIKxr5tK2dVcYmaCk2uqdjF4A==" crossorigin="anonymous"></script><script src="https://kit.fontawesome.com/6ecbd6c532.js" crossorigin="anonymous"></script><script src="libs/header-attrs-2.11/header-attrs.js"></script><script src="libs/jquery-3.6.0/jquery-3.6.0.min.js"></script><meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="libs/bootstrap-4.6.0/bootstrap.min.css" rel="stylesheet">
<script src="libs/bootstrap-4.6.0/bootstrap.bundle.min.js"></script><script src="libs/bs3compat-0.3.1.9000/transition.js"></script><script src="libs/bs3compat-0.3.1.9000/tabs.js"></script><script src="libs/bs3compat-0.3.1.9000/bs3compat.js"></script><link href="libs/bs4_book-1.0.0/bs4_book.css" rel="stylesheet">
<script src="libs/bs4_book-1.0.0/bs4_book.js"></script><script src="libs/kePrint-0.0.1/kePrint.js"></script><link href="libs/lightable-0.0.1/lightable.css" rel="stylesheet">
<!-- Global site tag (gtag.js) - Google Analytics --><script async src="https://www.googletagmanager.com/gtag/js?id=G-6NP3MF25W3"></script><script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());

      gtag('config', 'G-6NP3MF25W3');
    </script><script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/autocomplete.jquery.min.js" integrity="sha512-GU9ayf+66Xx2TmpxqJpliWbT5PiGYxpaG8rfnBEk1LL8l1KGkRShhngwdXK1UgqhAzWpZHSiYPc09/NwDQIGyg==" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mark.js/8.11.1/mark.min.js" integrity="sha512-5CYOlHXGh6QpOFA/TeTylKLWfB3ftPsde7AnmhuitiTX4K5SqCLBeKro6sPS8ilsz1Q4NRx3v8Ko2IBiszzdww==" crossorigin="anonymous"></script><!-- CSS --><link rel="stylesheet" href="include/psyteachr.css">
<link rel="stylesheet" href="include/webex.css">
<link rel="stylesheet" href="include/style.css">
</head>
<body data-spy="scroll" data-target="#toc">

<div class="container-fluid">
<div class="row">
  <header class="col-sm-12 col-lg-3 sidebar sidebar-book"><a class="sr-only sr-only-focusable" href="#content">Skip to main content</a>

    <div class="d-flex align-items-start justify-content-between">
      <h1>
        <a href="index.html" title="">Glossary</a>
      </h1>
      <button class="btn btn-outline-primary d-lg-none ml-2 mt-1" type="button" data-toggle="collapse" data-target="#main-nav" aria-expanded="true" aria-controls="main-nav"><i class="fas fa-bars"></i><span class="sr-only">Show table of contents</span></button>
    </div>

    <div id="main-nav" class="collapse-lg">
      <form role="search">
        <input id="search" class="form-control" type="search" placeholder="Search" aria-label="Search">
</form>

      <nav aria-label="Table of contents"><h2>Table of contents</h2>
        <ul class="book-toc list-unstyled">
<li><a class="" href="index.html">Overview</a></li>
<li><a class="" href="symbols.html"><span class="header-section-number">1</span> Symbols</a></li>
<li><a class="" href="a.html"><span class="header-section-number">2</span> A</a></li>
<li><a class="" href="b.html"><span class="header-section-number">3</span> B</a></li>
<li><a class="" href="c.html"><span class="header-section-number">4</span> C</a></li>
<li><a class="" href="d.html"><span class="header-section-number">5</span> D</a></li>
<li><a class="" href="e.html"><span class="header-section-number">6</span> E</a></li>
<li><a class="" href="f.html"><span class="header-section-number">7</span> F</a></li>
<li><a class="" href="g.html"><span class="header-section-number">8</span> G</a></li>
<li><a class="" href="h.html"><span class="header-section-number">9</span> H</a></li>
<li><a class="" href="i.html"><span class="header-section-number">10</span> I</a></li>
<li><a class="" href="j.html"><span class="header-section-number">11</span> J</a></li>
<li><a class="" href="k.html"><span class="header-section-number">12</span> K</a></li>
<li><a class="" href="l.html"><span class="header-section-number">13</span> L</a></li>
<li><a class="" href="m.html"><span class="header-section-number">14</span> M</a></li>
<li><a class="" href="n.html"><span class="header-section-number">15</span> N</a></li>
<li><a class="" href="o.html"><span class="header-section-number">16</span> O</a></li>
<li><a class="active" href="p.html"><span class="header-section-number">17</span> P</a></li>
<li><a class="" href="q.html"><span class="header-section-number">18</span> Q</a></li>
<li><a class="" href="r.html"><span class="header-section-number">19</span> R</a></li>
<li><a class="" href="s.html"><span class="header-section-number">20</span> S</a></li>
<li><a class="" href="t.html"><span class="header-section-number">21</span> T</a></li>
<li><a class="" href="u.html"><span class="header-section-number">22</span> U</a></li>
<li><a class="" href="v.html"><span class="header-section-number">23</span> V</a></li>
<li><a class="" href="w.html"><span class="header-section-number">24</span> W</a></li>
<li><a class="" href="x.html"><span class="header-section-number">25</span> X</a></li>
<li><a class="" href="y.html"><span class="header-section-number">26</span> Y</a></li>
<li><a class="" href="z.html"><span class="header-section-number">27</span> Z</a></li>
</ul>

        <div class="book-extra">
          <p><a id="book-repo" href="https://github.com/psyteachr/glossary">View book source <i class="fab fa-github"></i></a></p>
        </div>
      </nav>
</div>
  </header><main class="col-sm-12 col-md-9 col-lg-7" id="content"><div id="p" class="section level1" number="17">
<h1>
<span class="header-section-number">17</span> P<a class="anchor" aria-label="anchor" href="#p"><i class="fas fa-link"></i></a>
</h1>

<div id="p-value" class="section level2" number="17.1">
<h2>
<span class="header-section-number">17.1</span> p-value<a class="anchor" aria-label="anchor" href="#p-value"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>The probability of seeing an effect at least as extreme as what you have, if the real effect was the value you are testing against (e.g., a null effect)</dfn></p>
<p>For example, if you used a binomial test to test against a chance probability of 1/2 (e.g., the probability of heads when flipping a fair coin), then a p-value of 0.37 means that you could expect to see effects at least as extreme as your data (i.e., 55 or more heads <strong>or</strong> tails) 37% of the time just by chance alone.</p>
<div class="sourceCode" id="cb162"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># test how likely 55 heads (or a more extreme value)</span>
<span class="co"># is to result from 100 flips of a fair (prob = 0.5) coin</span>
<span class="fu"><a href="https://rdrr.io/r/stats/binom.test.html">binom.test</a></span><span class="op">(</span><span class="fl">55</span>, <span class="fl">100</span>, <span class="fl">0.5</span><span class="op">)</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;  Exact binomial test</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; data:  55 and 100</span>
<span class="co">#&gt; number of successes = 55, number of trials = 100,</span>
<span class="co">#&gt; p-value = 0.3682</span>
<span class="co">#&gt; alternative hypothesis: true probability of success is not equal to 0.5</span>
<span class="co">#&gt; 95 percent confidence interval:</span>
<span class="co">#&gt;  0.4472802 0.6496798</span>
<span class="co">#&gt; sample estimates:</span>
<span class="co">#&gt; probability of success </span>
<span class="co">#&gt;                   0.55</span></code></pre></div>
<p>P-values can be one-tailed or two-tailed. The example above if two-tailed because we didn't specify a direction and are testing whether there were more <strong>or</strong> fewer heads than expected by chance with a fair coin. The example below is one-tailed, and indicates that you have an 18% chance of getting 55 <strong>or more</strong> heads when flipping a fair coin 100 times.</p>
<div class="sourceCode" id="cb163"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># test how likely 55 (or more) heads</span>
<span class="co"># is to result from 100 flips of a fair (prob = 0.5) coin</span>
<span class="fu"><a href="https://rdrr.io/r/stats/binom.test.html">binom.test</a></span><span class="op">(</span><span class="fl">55</span>, <span class="fl">100</span>, <span class="fl">0.5</span>, alternative <span class="op">=</span> <span class="st">"greater"</span><span class="op">)</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;  Exact binomial test</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; data:  55 and 100</span>
<span class="co">#&gt; number of successes = 55, number of trials = 100,</span>
<span class="co">#&gt; p-value = 0.1841</span>
<span class="co">#&gt; alternative hypothesis: true probability of success is greater than 0.5</span>
<span class="co">#&gt; 95 percent confidence interval:</span>
<span class="co">#&gt;  0.4628896 1.0000000</span>
<span class="co">#&gt; sample estimates:</span>
<span class="co">#&gt; probability of success </span>
<span class="co">#&gt;                   0.55</span></code></pre></div>
<p>You can see that the p-value is half of the two-tailed value; this is true for symmetric distributions like the <a href="b.html#binomial-distribution">binomial distribution</a>, but not for all distributions.</p>
<p>If you do a one-tailed test using "less", the p-value is much higher, indicating that you have an 86% chance of getting 55 <strong>or fewer</strong> heads when flipping a fair coin 100 times.</p>
<div class="sourceCode" id="cb164"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># test how likely 55 (or fewer) heads</span>
<span class="co"># is to result from 100 flips of a fair (prob = 0.5) coin</span>
<span class="fu"><a href="https://rdrr.io/r/stats/binom.test.html">binom.test</a></span><span class="op">(</span><span class="fl">55</span>, <span class="fl">100</span>, <span class="fl">0.5</span>, alternative <span class="op">=</span> <span class="st">"less"</span><span class="op">)</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;  Exact binomial test</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; data:  55 and 100</span>
<span class="co">#&gt; number of successes = 55, number of trials = 100,</span>
<span class="co">#&gt; p-value = 0.8644</span>
<span class="co">#&gt; alternative hypothesis: true probability of success is less than 0.5</span>
<span class="co">#&gt; 95 percent confidence interval:</span>
<span class="co">#&gt;  0.0000000 0.6348377</span>
<span class="co">#&gt; sample estimates:</span>
<span class="co">#&gt; probability of success </span>
<span class="co">#&gt;                   0.55</span></code></pre></div>

</div>
<div id="package" class="section level2" number="17.2">
<h2>
<span class="header-section-number">17.2</span> package<a class="anchor" aria-label="anchor" href="#package"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A group of R functions.</dfn></p>
<p>Many useful functions are built into R and available by default whenever you start it up. But some of the most powerful things you can do with R require packages of functions that are written by the community. The functions in these packages aren't available until you install the package (using <code>install.packages("package_name")</code> or clicking Install on the Packages pane; this only needs to be done if the package isn't already installed). Once that package is installed (kind of like downloading an app to your phone), you can use it in any script by loading that package as a library at the top of your script (e.g., (<code><a href="https://ggplot2.tidyverse.org">library(ggplot2)</a></code>).</p>
<div class="info">
<p>You can alternatively type the package name and two colons before any function from that package to use it without loading all of its functions into the library (e.g., <code><a href="https://rdrr.io/pkg/ggplot2/man/geom_histogram.html">ggplot2::geom_histogram()</a></code>). This sort of notation is also used to disambiguate function names if two packages have functions with the same names.</p>
</div>

</div>
<div id="pandoc" class="section level2" number="17.3">
<h2>
<span class="header-section-number">17.3</span> pandoc<a class="anchor" aria-label="anchor" href="#pandoc"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A universal document convertor, used by R to make PDF or Word documents from <a href="r.html#r-markdown">R Markdown</a></dfn></p>
<p><a href="https://pandoc.org/" target="_blank">Pandoc.org</a></p>

</div>
<div id="panes" class="section level2" number="17.4">
<h2>
<span class="header-section-number">17.4</span> panes<a class="anchor" aria-label="anchor" href="#panes"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>RStudio is arranged with four window "panes".</dfn></p>
<p>By default, the upper left pane is the <strong>source pane</strong>, where you view and edit source code from files. The bottom left pane is usually the <a href="c.html#console">console pane</a>, where you can type in commands and view output messages You can change the location of panes and what tabs are shown under <strong><code>Preferences &gt; Pane Layout</code></strong>.</p>
<div class="figure" style="text-align: center">
<span style="display:block;" id="fig:img-panes"></span>
<img src="images/defs/panes.png" alt="Pane layout" width="100%"><p class="caption">
Figure 17.1: Pane layout
</p>
</div>

</div>
<div id="parameter" class="section level2" number="17.5">
<h2>
<span class="header-section-number">17.5</span> parameter<a class="anchor" aria-label="anchor" href="#parameter"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A quantity characterizing a population.</dfn></p>
<p>Often parameters describe a population <a href="d.html#distribution">distribution</a>, such as its <a href="m.html#mean">mean</a> or <a href="s.html#standard-deviation">SD</a>. They are typically unknown, and therefore must be estimated from the data.</p>

</div>
<div id="path" class="section level2" number="17.6">
<h2>
<span class="header-section-number">17.6</span> path<a class="anchor" aria-label="anchor" href="#path"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A string representing the location of a file or <a href="d.html#directory">directory</a>.</dfn></p>
<p>A file path can be <a href="r.html#relative-path">relative</a> to the <a href="w.html#working-directory">working directory</a> or <a href="a.html#absolute-path">absolute</a>.</p>
<div class="sourceCode" id="cb165"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># list all files in the images directory, </span>
<span class="co"># use relative path</span>
<span class="fu"><a href="https://rdrr.io/r/base/list.files.html">list.files</a></span><span class="op">(</span>path <span class="op">=</span> <span class="st">"images/"</span><span class="op">)</span></code></pre></div>
<div class="sourceCode" id="cb166"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># list all files on the Desktop, </span>
<span class="co"># use absolute path</span>
<span class="fu"><a href="https://rdrr.io/r/base/list.files.html">list.files</a></span><span class="op">(</span>path <span class="op">=</span> <span class="st">"/Users/myaccount/Desktop/"</span><span class="op">)</span></code></pre></div>

</div>
<div id="pipe" class="section level2" number="17.7">
<h2>
<span class="header-section-number">17.7</span> pipe<a class="anchor" aria-label="anchor" href="#pipe"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A way to order your code in a more readable format using the symbol %&gt;%</dfn></p>
<p>The symbol <code>%&gt;%</code> takes the <a href="o.html#object">object</a> created by a function and sends it to the next function. By default, it will be used as the first <a href="a.html#argument">argument</a>, and most <a href="t.html#tidyverse">tidyverse</a> functions are optimised for this, but you can also include the result as another argument using <code>.</code> (see the example below).</p>
<p>Instead of making a new object for each step:</p>
<div class="sourceCode" id="cb167"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># this makes 4 unnecessary objects</span>
<span class="va">data</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span><span class="op">(</span><span class="fl">20</span><span class="op">)</span>         <span class="co"># simulate 20 values</span>
<span class="va">t</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/t.test.html">t.test</a></span><span class="op">(</span><span class="va">data</span><span class="op">)</span>         <span class="co"># 1-sample t-test</span>
<span class="va">p</span> <span class="op">&lt;-</span> <span class="va">t</span><span class="op">$</span><span class="va">p.value</span>            <span class="co"># extract p-value</span>
<span class="va">rounded_p</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/base/Round.html">round</a></span><span class="op">(</span><span class="va">p</span>, <span class="fl">3</span><span class="op">)</span>  <span class="co"># round to 3 digits</span>
<span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste</a></span><span class="op">(</span><span class="st">"p = "</span>, <span class="va">rounded_p</span><span class="op">)</span>  <span class="co"># format</span>
<span class="co">#&gt; [1] "p =  0.363"</span></code></pre></div>
<p>Or nesting functions:</p>
<div class="sourceCode" id="cb168"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="co"># this is unreadable; never do this</span>
<span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste</a></span><span class="op">(</span><span class="st">"p = "</span>, <span class="fu"><a href="https://rdrr.io/r/base/Round.html">round</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/t.test.html">t.test</a></span><span class="op">(</span><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span><span class="op">(</span><span class="fl">20</span><span class="op">)</span><span class="op">)</span><span class="op">$</span><span class="va">p.value</span>, <span class="fl">3</span><span class="op">)</span><span class="op">)</span>
<span class="co">#&gt; [1] "p =  0.363"</span></code></pre></div>
<p>You can pipe the results of each function to the next function:</p>
<div class="sourceCode" id="cb169"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="fu"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span><span class="op">(</span><span class="fl">20</span><span class="op">)</span> <span class="op"><a href="https://rdrr.io/pkg/magrittr/man/pipe.html">%&gt;%</a></span>         <span class="co"># simulate 20 values</span>
  <span class="fu"><a href="https://rdrr.io/r/stats/t.test.html">t.test</a></span><span class="op">(</span><span class="op">)</span> <span class="op"><a href="https://rdrr.io/pkg/magrittr/man/pipe.html">%&gt;%</a></span>        <span class="co"># 1-sample t-test</span>
  <span class="fu">`[[`</span><span class="op">(</span><span class="st">"p.value"</span><span class="op">)</span> <span class="op"><a href="https://rdrr.io/pkg/magrittr/man/pipe.html">%&gt;%</a></span> <span class="co"># extract p-value, `[[`(data, "x") is the same as data[["x"]]</span>
  <span class="fu"><a href="https://rdrr.io/r/base/Round.html">round</a></span><span class="op">(</span><span class="fl">3</span><span class="op">)</span> <span class="op"><a href="https://rdrr.io/pkg/magrittr/man/pipe.html">%&gt;%</a></span>        <span class="co"># round to 3 digits</span>
  <span class="fu"><a href="https://rdrr.io/r/base/paste.html">paste</a></span><span class="op">(</span><span class="st">"p = "</span>, <span class="va">.</span><span class="op">)</span>    <span class="co"># format </span>
<span class="co">#&gt; [1] "p =  0.363"</span>
                      <span class="co"># use . to represent the previous data if it's not the first argument</span></code></pre></div>
<p>See a more <a href="https://debruine.github.io/posts/pipes/" target="_blank">detailed example</a>.</p>
<p>The <a href="symbols.html">symbol</a> <code>|</code> is also called a "pipe" and means "OR" in R, although it has other meanings that are more similar to the <code>%&gt;%</code> pipe in some other programming languages.</p>

</div>
<div id="poisson-distribution" class="section level2" number="17.8">
<h2>
<span class="header-section-number">17.8</span> Poisson distribution<a class="anchor" aria-label="anchor" href="#poisson-distribution"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A <a href="d.html#distribution">distribution</a> that models independent events happening over a unit of time</dfn></p>
<div class="sourceCode" id="cb170"><pre class="downlit sourceCode r">
<code class="sourceCode R"><span class="va">lambda</span> <span class="op">&lt;-</span> <span class="fl">3</span> <span class="co"># mean number of events</span>
<span class="va">x</span> <span class="op">&lt;-</span> <span class="fu"><a href="https://rdrr.io/r/stats/Poisson.html">rpois</a></span><span class="op">(</span><span class="fl">10000</span>, <span class="va">lambda</span><span class="op">)</span></code></pre></div>
<div class="figure" style="text-align: center">
<span style="display:block;" id="fig:poisson-plot"></span>
<img src="_main_files/figure-html/poisson-plot-1.png" alt="Poisson Distribution" width="100%"><p class="caption">
Figure 17.2: Poisson Distribution
</p>
</div>

</div>
<div id="population-parameter" class="section level2" number="17.9">
<h2>
<span class="header-section-number">17.9</span> population parameter<a class="anchor" aria-label="anchor" href="#population-parameter"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A quantity representing a property of a population of interest.</dfn></p>
<p>In a psychology context, parameters are constants that are assumed to reflect a typical values for some property appearing in some human group to which we want to generalized. For instance, it may reflect an overall reaction time or an overall priming effect, with individual subjects varying from this fixed value. Population parameters are typically unobserved and usually unobservable due to sampling error and measurement error, and are estimated from the values in the sample. The exception is in data simulation, where hypothetical population parameters can be fixed by the researcher.</p>

</div>
<div id="population" class="section level2" number="17.10">
<h2>
<span class="header-section-number">17.10</span> population<a class="anchor" aria-label="anchor" href="#population"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>All members of a group that we wish to generalise our findings to. E.g. all students taking Psychology at the University of Glasgow. We draw our testing <a href="s.html#sample">sample</a> from the population.</dfn>.</p>
<p>The population of interest can be any group and it is important that you define this in your study when considering the generalisability of your tests and how you will conduct your sampling. If you want to generalise to everyone in the world then that is the population you should sample from. If you want to generalise to everyone taking Psychology at the University of Glasgow then those are the people you should specifically sample from.</p>
<p>Remember that populations don't have to be humans but could refer to all possible variations of a face for example. The key question is who or what do your results generalise to.</p>
<p>For an interesting paper on populations, samples and generalisability, see:</p>
<ul>
<li><a href="https://journals.sagepub.com/doi/10.1177/1745691617708630" target="_blank">Simons, D. J., Shoda, Y., &amp; Lindsay, D. S. (2017). Constraints on Generality (COG): A Proposed Addition to All Empirical Papers. Perspectives on Psychological Science, 12(6), 1123–1128. https://doi.org/10.1177/1745691617708630</a></li>
</ul>
</div>
<div id="power" class="section level2" number="17.11">
<h2>
<span class="header-section-number">17.11</span> power<a class="anchor" aria-label="anchor" href="#power"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>The probability of rejecting the null hypothesis when it is false.</dfn></p>
<p>Formally, the probability of rejecting the null hypothesis, when the null hypothesis is false. Informally, the likelihood of successfully detecting an effect that is actually there (<a href="https://doi.org/10.1016/j.apergo.2004.01.002">Baguley, 2004</a>). In its simplest application, there is a relationship between alpha, power, effect size, and sample size. This means we can calculate power if we know alpha, the effect size, and the sample size. This would tell us - in the long run - how many times would I observe a significant effect for a given alpha, effect size, and sample size?</p>

</div>
<div id="predictor-variable" class="section level2" number="17.12">
<h2>
<span class="header-section-number">17.12</span> predictor variable<a class="anchor" aria-label="anchor" href="#predictor-variable"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A variable whose value is used (in a model) to predict the value of a <a href="r.html#response-variable">response variable</a>.</dfn></p>
<p>In an experimental context, predictor variables are often referred to as <a href="i.html#independent-variable">independent variables</a>.</p>

</div>
<div id="preregistration" class="section level2" number="17.13">
<h2>
<span class="header-section-number">17.13</span> preregistration<a class="anchor" aria-label="anchor" href="#preregistration"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>Specifying the methods and analysis of a study before it is run.</dfn></p>
<p>Resources</p>
<ul>
<li><a href="https://www.cos.io/our-services/prereg" target="_blank">Center for Open Science</a></li>
<li>The Preregistration Revolution: <a href="https://doi.org/10.1073/pnas.1708274114" target="_blank">PNAS</a> / <a href="https://osf.io/2dxu5/" target="_blank">Preprint</a>
</li>
</ul>
</div>
<div id="probability" class="section level2" number="17.14">
<h2>
<span class="header-section-number">17.14</span> probability<a class="anchor" aria-label="anchor" href="#probability"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A number between 0 and 1 where 0 indicates impossibility of the event and 1 indicates certainty</dfn></p>

</div>
<div id="project" class="section level2" number="17.15">
<h2>
<span class="header-section-number">17.15</span> project<a class="anchor" aria-label="anchor" href="#project"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>A way to organise related files in RStudio</dfn>.</p>
<p>Choose <strong><code>New Project...</code></strong> under the <strong><code>File</code></strong> menu to create a new project in a new folder, organise an existing folder of files as a project, or download a version controlled repository as a project.</p>
<div class="figure" style="text-align: center">
<span style="display:block;" id="fig:new-project"></span>
<img src="images/new_project.png" alt="Start a new project" width="100%"><p class="caption">
Figure 17.3: Start a new project
</p>
</div>

</div>
<div id="pseudoreplication" class="section level2" number="17.16">
<h2>
<span class="header-section-number">17.16</span> pseudoreplication<a class="anchor" aria-label="anchor" href="#pseudoreplication"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>The process of artificially inflating the number of samples or replicates</dfn></p>
<p>Pseudoreplications can occur when you take multiple measurements within the same condition.</p>
<p>For instance, imagine a study where you randomly assign participants to consume one of two beverages—alcohol or water—before administering a simple response time task where they press a button as fast as possible when a light flashes. You would probably take more than one measurement of response time for each participant; let's assume that you measured it over 100 trials. You’d have one between-subject factor (beverage) and 100 observations per subject, for say, 20 subjects in each group.</p>
<p>One common mistake novices make when analyzing such data is to try to run a t-test. You can’t directly use a conventional t-test when you have pseudoreplications (or multiple stimuli). You must first calculate means for each subject, and then run your analysis on the means, not on the raw data. There are versions of ANOVA that can deal with pseudoreplications, but you are probably better off using a <a href="l.html#linear-mixed-effects-model">linear-mixed effects model</a>, which can better handle the complex dependency structure.</p>

</div>
<div id="push" class="section level2" number="17.17">
<h2>
<span class="header-section-number">17.17</span> push<a class="anchor" aria-label="anchor" href="#push"><i class="fas fa-link"></i></a>
</h2>
<p><dfn>Updating the remote git project from the local project.</dfn></p>
<p>After you <a href="c.html#commit">commit</a> changes to a <a href="g.html#git">git</a> project, you may want to push those changes to a remote project, such as one on <a href="g.html#github">GitHub</a>.</p>

</div>
</div>
<script>

/* update total correct if #webex-total_correct exists */
update_total_correct = function() {
  console.log("webex: update total_correct");

  if (t = document.getElementById("webex-total_correct")) {
    var correct = document.getElementsByClassName("webex-correct").length;
    var solvemes = document.getElementsByClassName("webex-solveme").length;
    var radiogroups = document.getElementsByClassName("webex-radiogroup").length;
    var selects = document.getElementsByClassName("webex-select").length;
    
    t.innerHTML = correct + " of " + (solvemes + radiogroups + selects) + " correct";
  }
}

/* webex-solution button toggling function */
b_func = function() {
  console.log("webex: toggle hide");
  
  var cl = this.parentElement.classList;
  if (cl.contains('open')) {
    cl.remove("open");
  } else {
    cl.add("open");
  }
}

/* function for checking solveme answers */
solveme_func = function(e) {
  console.log("webex: check solveme");

  var real_answers = JSON.parse(this.dataset.answer);
  var my_answer = this.value;
  var cl = this.classList;
  if (cl.contains("ignorecase")) {
    my_answer = my_answer.toLowerCase();
  }
  if (cl.contains("nospaces")) {
    my_answer = my_answer.replace(/ /g, "")
  }

  if (my_answer == "") {
    cl.remove("webex-correct");
    cl.remove("webex-incorrect");
  } else if (real_answers.includes(my_answer)) {
    cl.add("webex-correct");
    cl.remove("webex-incorrect");
  } else {
    cl.add("webex-incorrect");
    cl.remove("webex-correct");
  }

  // match numeric answers within a specified tolerance
  if(this.dataset.tol > 0){
    var tol = JSON.parse(this.dataset.tol);
    var matches = real_answers.map(x => Math.abs(x - my_answer) < tol)
    if (matches.reduce((a, b) => a + b, 0) > 0) {
      cl.add("webex-correct");
    } else {
      cl.remove("webex-correct");
    }
  }

  // added regex bit
  if (cl.contains("regex")){
    answer_regex = RegExp(real_answers.join("|"))
    if (answer_regex.test(my_answer)) {
      cl.add("webex-correct");
    }
  }

  update_total_correct();
}

/* function for checking select answers */
select_func = function(e) {
  console.log("webex: check select");
  
  var cl = this.classList
  
  /* add style */
  cl.remove("webex-incorrect");
  cl.remove("webex-correct");
  if (this.value == "answer") {
    cl.add("webex-correct");
  } else if (this.value != "blank") {
    cl.add("webex-incorrect");
  }
  
  update_total_correct();
}

/* function for checking radiogroups answers */
radiogroups_func = function(e) {
  console.log("webex: check radiogroups");

  var checked_button = document.querySelector('input[name=' + this.id + ']:checked');
  var cl = checked_button.parentElement.classList;
  var labels = checked_button.parentElement.parentElement.children;
  
  /* get rid of styles */
  for (i = 0; i < labels.length; i++) {
    labels[i].classList.remove("webex-incorrect");
    labels[i].classList.remove("webex-correct");
  }
  
  /* add style */
  if (checked_button.value == "answer") {
    cl.add("webex-correct");
  } else {
    cl.add("webex-incorrect");
  }
  
  update_total_correct();
}

window.onload = function() {
  console.log("onload");
  /* set up solution buttons */
  var buttons = document.getElementsByTagName("button");

  for (var i = 0; i < buttons.length; i++) {
    if (buttons[i].parentElement.classList.contains('webex-solution')) {
      buttons[i].onclick = b_func;
    }
  }

  /* set up webex-solveme inputs */
  var solveme = document.getElementsByClassName("webex-solveme");

  for (var i = 0; i < solveme.length; i++) {
    /* make sure input boxes don't auto-anything */
    solveme[i].setAttribute("autocomplete","off");
    solveme[i].setAttribute("autocorrect", "off");
    solveme[i].setAttribute("autocapitalize", "off");
    solveme[i].setAttribute("spellcheck", "false");
    solveme[i].value = "";

    /* adjust answer for ignorecase or nospaces */
    var cl = solveme[i].classList;
    var real_answer = solveme[i].dataset.answer;
    if (cl.contains("ignorecase")) {
      real_answer = real_answer.toLowerCase();
    }
    if (cl.contains("nospaces")) {
      real_answer = real_answer.replace(/ /g, "");
    }
    solveme[i].dataset.answer = real_answer;

    /* attach checking function */
    solveme[i].onkeyup = solveme_func;
    solveme[i].onchange = solveme_func;
  }
  
  /* set up radiogroups */
  var radiogroups = document.getElementsByClassName("webex-radiogroup");
  for (var i = 0; i < radiogroups.length; i++) {
    radiogroups[i].onchange = radiogroups_func;
  }
  
  /* set up selects */
  var selects = document.getElementsByClassName("webex-select");
  for (var i = 0; i < selects.length; i++) {
    selects[i].onchange = select_func;
  }

  update_total_correct();
}

</script><script>
$( document ).ready(function() {
  var cite = ' ';
  var psyteachr = ' <a href="https://psyteachr.github.io/"><img src="images/logos/psyteachr_logo.png" style="height: 31px; color: white;" alt="psyTeachR: Reproducible Research" /></a>';
  var license = ' <a rel="license" href="https://creativecommons.org/licenses/by-sa/4.0/" target="blank"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-sa/4.0/88x31.png"></a>';

  $("footer div.row div:eq(1) p").html(
    psyteachr + license + cite
  );
  
  $("#toc").appendTo($("#main-nav"));
});
</script><div class="chapter-nav">
<div class="prev"><a href="o.html"><span class="header-section-number">16</span> O</a></div>
<div class="next"><a href="q.html"><span class="header-section-number">18</span> Q</a></div>
</div></main><div class="col-md-3 col-lg-2 d-none d-md-block sidebar sidebar-chapter">
    <nav id="toc" data-toggle="toc" aria-label="On this page"><h2>On this page</h2>
      <ul class="nav navbar-nav">
<li><a class="nav-link" href="#p"><span class="header-section-number">17</span> P</a></li>
<li><a class="nav-link" href="#p-value"><span class="header-section-number">17.1</span> p-value</a></li>
<li><a class="nav-link" href="#package"><span class="header-section-number">17.2</span> package</a></li>
<li><a class="nav-link" href="#pandoc"><span class="header-section-number">17.3</span> pandoc</a></li>
<li><a class="nav-link" href="#panes"><span class="header-section-number">17.4</span> panes</a></li>
<li><a class="nav-link" href="#parameter"><span class="header-section-number">17.5</span> parameter</a></li>
<li><a class="nav-link" href="#path"><span class="header-section-number">17.6</span> path</a></li>
<li><a class="nav-link" href="#pipe"><span class="header-section-number">17.7</span> pipe</a></li>
<li><a class="nav-link" href="#poisson-distribution"><span class="header-section-number">17.8</span> Poisson distribution</a></li>
<li><a class="nav-link" href="#population-parameter"><span class="header-section-number">17.9</span> population parameter</a></li>
<li><a class="nav-link" href="#population"><span class="header-section-number">17.10</span> population</a></li>
<li><a class="nav-link" href="#power"><span class="header-section-number">17.11</span> power</a></li>
<li><a class="nav-link" href="#predictor-variable"><span class="header-section-number">17.12</span> predictor variable</a></li>
<li><a class="nav-link" href="#preregistration"><span class="header-section-number">17.13</span> preregistration</a></li>
<li><a class="nav-link" href="#probability"><span class="header-section-number">17.14</span> probability</a></li>
<li><a class="nav-link" href="#project"><span class="header-section-number">17.15</span> project</a></li>
<li><a class="nav-link" href="#pseudoreplication"><span class="header-section-number">17.16</span> pseudoreplication</a></li>
<li><a class="nav-link" href="#push"><span class="header-section-number">17.17</span> push</a></li>
</ul>

      <div class="book-extra">
        <ul class="list-unstyled">
<li><a id="book-source" href="https://github.com/psyteachr/glossary/blob/master/terms/p-.Rmd">View source <i class="fab fa-github"></i></a></li>
          <li><a id="book-edit" href="https://github.com/psyteachr/glossary/edit/master/terms/p-.Rmd">Edit this page <i class="fab fa-github"></i></a></li>
        </ul>
</div>
    </nav>
</div>

</div>
</div> <!-- .container -->

<footer class="bg-primary text-light mt-5"><div class="container"><div class="row">

  <div class="col-12 col-md-6 mt-3">
    <p>"<strong>Glossary</strong>" was written by psyTeachR Team. It was last built on 2022-02-27.</p>
  </div>

  <div class="col-12 col-md-6 mt-3">
    <p>This book was built by the <a class="text-light" href="https://bookdown.org">bookdown</a> R package.</p>
  </div>

</div></div>
</footer><!-- dynamically load mathjax for compatibility with self-contained --><script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    var src = "true";
    if (src === "" || src === "true") src = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-MML-AM_CHTML";
    if (location.protocol !== "file:")
      if (/^https?:/.test(src))
        src = src.replace(/^https?:/, '');
    script.src = src;
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script><script type="text/x-mathjax-config">const popovers = document.querySelectorAll('a.footnote-ref[data-toggle="popover"]');
for (let popover of popovers) {
  const div = document.createElement('div');
  div.setAttribute('style', 'position: absolute; top: 0, left:0; width:0, height:0, overflow: hidden; visibility: hidden;');
  div.innerHTML = popover.getAttribute('data-content');

  var has_math = div.querySelector("span.math");
  if (has_math) {
    document.body.appendChild(div);
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, div]);
    MathJax.Hub.Queue(function() {
      popover.setAttribute('data-content', div.innerHTML);
      document.body.removeChild(div);
    })
  }
}
</script>
</body>
</html>
